<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>系统设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
		.layui-form-label{width:110px!important}
		.map-search-res:hover{
			background-color: gray;
		}
		.picsList-class{float:left;padding-top:10px;padding-left:140px;clear: both;}
		.picsList-class .layui-imgbox{margin-right: 20px;}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">
						<i class="fa fa-pencil"></i> 商家设置
						<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
					</div>
          <div class="layui-card-body" pad15>
            <div class="layui-form">
							<input type="hidden" name="info[id]" value="{$info.id}"/>
							<div class="layui-form-item">
								<label class="layui-form-label">商户名称：</label>
								<div class="layui-form-mid" style="width:200px;color:#333">{$info.name}</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">客服电话：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="text" name="info[tel]" class="layui-input" value="{$info.tel}">
								</div>
							</div>
							<!-- <div class="layui-form-item">
								<label class="layui-form-label">客服链接：</label>
								<div class="layui-input-inline" style="width:300px">
									<input type="text" name="info[kfurl]" value="{$info.kfurl}" class="layui-input"/>
								</div>
								<div class="layui-form-mid layui-word-aux">商品详情页客服链接，不填写则使用商城内部客服系统</div>
							</div> -->
							<div class="layui-form-item">
								<label class="layui-form-label">商家LOGO：</label>
								<input type="hidden" name="info[logo]" id="logo" lay-verType="tips" class="layui-input" value="{$info.logo}">
								<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="logo" upload-preview="logoPreview" onclick="uploader(this)">上传图片</button>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
								<div id="logoPreview" class="picsList-class">
									<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$info.logo}"/></div></div>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">商家照片：</label>
								<input type="hidden" name="info[pics]" value="{$info['pics']}" id="pics">
								<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="pics" upload-preview="picList" >批量上传</button>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：600*340像素</div>
								<div id="picList" class="picsList-class">
									{if $info['pics']}
									{php}$pics = explode(',',$info['pics']);{/php}
									{foreach $pics as $pic}
									<div class="layui-imgbox">
										<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('pics','picList')" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
										<span class="layui-imgbox-img"><img src="{$pic}" onclick="previewImg('{$pic}')"></span>
									</div>
									{/foreach}{/if}
								</div>
							</div>
							<!-- <div class="layui-form-item">
								<label class="layui-form-label">摘要：</label>
								<div class="layui-input-inline" style="width:700px">
									<input type="text" name="info[subname]" class="layui-input" value="{$info.subname}">
								</div>
							</div> -->
							<!-- <div class="layui-form-item">
								<label class="layui-form-label">服务标签：</label>
								<div class="layui-input-inline" style="width:400px">
									<input type="text" name="info[fuwupoint]" class="layui-input" value="{$info.fuwupoint}">
								</div>
								<div class="layui-form-mid layui-word-aux">多个用空格隔开,如: 7天退换 48小时发货 假一赔十</div>
							</div> -->
							<div class="layui-form-item">
								<label class="layui-form-label">商家简介：</label>
								<div class="layui-input-inline" style="width:500px;">
									<script id="content" name="info[content]" type="text/plain" style="width:100%;height:500px">{$info.content}</script>
									<!-- <textarea name="info[content]" class="layui-textarea" style="height:250px">{$info.content}</textarea> -->
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">商家地址：</label>
								<div style="display: flex;flex-direction: column;">
									<div class="areaDiv" style="margin-bottom: 8px">
										<div class="layui-input-inline" style="width: 150px">
											<select name="info[province]" id="province" lay-filter="province" {if !$info.id}lay-verify="required"{/if}></select>
										</div>
										<div class="layui-input-inline" style="width: 150px">
											<select name="info[city]" id="city" lay-filter="city"></select>
										</div>
										<div class="layui-input-inline" style="width: 150px" style="display:none">
											<!--							<select name="custom[form{$customeKey}][]" id="region{$customeKey}_area"></select>-->
											<select name="info[district]" id="district"></select>
										</div>
									</div>
									<div class="adressDiv">
										<div class="layui-input-inline" style="width:500px">
											<input type="text" id="address" name="info[address]" class="layui-input layui-input-search" value="{$info.address}">
											<div style="position: absolute;width: 500px;z-index: 100;" class="search-keywords">

											</div>
										</div>
										<button class="layui-btn layui-btn-primary" id="searchbtn">搜索</button>
									</div>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"></label>
								<div id="l-map" style="width:600px;height:350px">地图加载中...</div>
								<div style="margin-left:140px;margin-top:10px">
									<div class="layui-input-inline" style="width:200px">
										<input type="text" name="info[longitude]" id="mapjd" class="layui-input" value="{$info.longitude|default='116.39782905578613'}"/>
									</div>
									<div class="layui-input-inline" style="width:200px">
										<input type="text" name="info[latitude]" id="mapwd" class="layui-input" value="{$info.latitude|default='39.90358020251377'}"/>
									</div>
								</div>
							</div>

							<fieldset class="layui-elem-field layui-field-title">
								<legend style="font-size: 14px;">退货设置-开始</legend>
							</fieldset>
							<div class="layui-form-item">
							  <label class="layui-form-label">联系人：</label>
							  <div class="layui-input-inline">
								  <input type="text" name="info[return_name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.return_name}">
							  </div>
						  </div>
						  <div class="layui-form-item">
							  <label class="layui-form-label">联系电话：</label>
							  <div class="layui-input-inline">
								  <input type="text" name="info[return_tel]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.return_tel}">
							  </div>
						  </div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">退货地址：</label>
								<div style="display: flex;flex-direction: column;">
									<div class="areaDiv" style="margin-bottom: 8px">
										<div class="layui-input-inline" style="width: 150px">
											<select name="info[return_province]" id="return_province" lay-filter="return_province" {if !$info.id}lay-verify="required"{/if}></select>
										</div>
										<div class="layui-input-inline" style="width: 150px">
											<select name="info[return_city]" id="return_city" lay-filter="return_city"></select>
										</div>
										<div class="layui-input-inline" style="width: 150px" style="display:none">
											<select name="info[return_area]" id="return_area"></select>
										</div>
									</div>
									<div class="adressDiv">
									<div class="layui-input-inline" style="width:500px">
										<input type="text" id="return_address" name="info[return_address]" placeholder="详细地址" class="layui-input layui-input-search" value="{$info.return_address}">
									</div>
									</div>
								</div>
								<div class="layui-form-mid layui-word-aux layui-clear">仅商城商品退款使用</div>
							</div>
							<fieldset class="layui-elem-field layui-field-title">
								<legend style="font-size: 14px;">退货设置-结束</legend>
							</fieldset>

							<div class="layui-form-item">
								<label class="layui-form-label">营业时间：</label>
								<div class="layui-input-inline" style="width:120px">
									<input type="text" name="info[start_hours]" class="layui-input" value="{$info.start_hours}" id="start_hours" autocomplete="off">
								</div>
								<div class="layui-form-mid">到</div>
								<div class="layui-input-inline" style="width:120px">
									<input type="text" name="info[end_hours]" class="layui-input" value="{$info.end_hours}" id="end_hours" autocomplete="off">
								</div>
								<div class="layui-input-inline" style="width:120px;clear:left;margin-left:140px">
									<input type="text" name="info[start_hours2]" class="layui-input" value="{$info.start_hours2}" id="start_hours2" autocomplete="off">
								</div>
								<div class="layui-form-mid">到</div>
								<div class="layui-input-inline" style="width:120px">
									<input type="text" name="info[end_hours2]" class="layui-input" value="{$info.end_hours2}" id="end_hours2" autocomplete="off">
								</div>
								<div class="layui-input-inline" style="width:120px;clear:left;margin-left:140px">
									<input type="text" name="info[start_hours3]" class="layui-input" value="{$info.start_hours3}" id="start_hours3" autocomplete="off">
								</div>
								<div class="layui-form-mid">到</div>
								<div class="layui-input-inline" style="width:120px">
									<input type="text" name="info[end_hours3]" class="layui-input" value="{$info.end_hours3}" id="end_hours3" autocomplete="off">
								</div>
								<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:140px">结束时间小于或等于开始时间表示跨天,如:00:00到00:00点表示全天营业,16:00到06:00表示下午4点到次日早晨6点</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">打烊后接单：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="radio" name="info[end_buy_status]" title="关闭" value="0" {if $info['end_buy_status']==0}checked{/if}/>
									<input type="radio" name="info[end_buy_status]" title="开启" value="1" {if $info['end_buy_status']==1}checked{/if}/>
								</div>
								<div class="layui-form-mid layui-word-aux">非营业时间为打烊时间</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label">微信号：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="text" name="info[weixin]" class="layui-input" value="{$info.weixin}">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">支付宝：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="text" name="info[aliaccount]" class="layui-input" value="{$info.aliaccount}">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">开户行：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="text" name="info[bankname]" class="layui-input" value="{$info.bankname}">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">持卡人：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="text" name="info[bankcarduser]" class="layui-input" value="{$info.bankcarduser}">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">银行卡号：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="text" name="info[bankcardnum]" class="layui-input" value="{$info.bankcardnum}">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" >发票开关：</label>
								<div class="layui-input-inline">
									<input type="radio" name="info[invoice]" value="1" {if $info['invoice']==1}checked{/if} title="开启" />
									<input type="radio" name="info[invoice]" value="0" {if $info['invoice']==0}checked{/if} title="关闭" />
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">发票类型：</label>
								<div class="layui-input-inline" style="width:300px">
									<input type="checkbox" name="info[invoice_type][]" value="1" title="普通发票" lay-skin="primary" {if in_array('1',$info['invoice_type'])}checked{/if}/>
									<input type="checkbox" name="info[invoice_type][]" value="2" title="增值税专用发票" lay-skin="primary" {if in_array('2',$info['invoice_type'])}checked{/if}/>
								</div>
							</div>
							

							
						  	{if getcustom('touzi_fenhong')}
							  {if $admin['shareholder_status'] && $info['shareholder_status']}
							
							  <div class="layui-form-item">
								  <label class="layui-form-label" style="width:130px">{:t('投资分红')}结算方式：</label>
								  <div class="layui-input-inline" style="width:300px">
									  <input type="radio" name="info[touzi_fh_type]" title="按销售金额" value="0" {if $info['touzi_fh_type']==0}checked{/if}/>
									  <input type="radio" name="info[touzi_fh_type]" title="按销售利润" value="1" {if $info['touzi_fh_type']==1}checked{/if}/>
								  </div>
								  <div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:160px">按销售金额结算即：销售价格×提成百分比，按销售利润即：（销售价格-商品成本）×提成百分比</div>
							  </div>
							  <div class="layui-form-item">
								  <label class="layui-form-label" style="width:130px">{:t('投资分红')}分配比例：</label>
								  <div class="layui-input-inline" style="width: 100px;margin-right: 0;">
									  <input style="border-radius:0 2px 2px 0" type="text" name="info[touzi_fh_percent]" class="layui-input" value="{$info.touzi_fh_percent}">
								  </div>
								  <div class="layui-form-mid" style="margin-left:0;background:#e6e6e6;padding: 9px 9px !important">%</div>
								  <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">如设置10%，则是本人投资额 ÷
									  所有人的投资额总和 x 订单销售额（或利润）x 10%</div>
							  </div>
							  {/if}
						  {/if}
						    
							<div class="layui-form-item">
								<label class="layui-form-label" >店铺状态：</label>
								<div class="layui-input-inline">
									<input type="radio" name="info[is_open]" value="1" {if $info['is_open']==1}checked{/if} title="营业" />
									<input type="radio" name="info[is_open]" value="0" {if $info['is_open']==0}checked{/if} title="休息" />
								</div>
								<div class="layui-form-mid">休息时不接单</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" ></label>
								<div class="layui-input-block">
									<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
								</div>
							</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
	{include file="public/js"/}
  <script src="__STATIC__/admin/js/address3.js"></script>
  <script src="__STATIC__/admin/js/searchaddress.js"></script>
  <script>
	  address3('province','city','district',"{$info.province}","{$info.city}","{$info.district}");
	  address3('return_province','return_city','return_area',"{$info.return_province}","{$info.return_city}","{$info.return_area}");
  </script>
	<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=ABLBZ-4BIKU-GFTVB-BK7IK-OLQ35-QCBFF&libraries=place"></script>
	<script>

	layui.laydate.render({ 
		elem: '#start_hours',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#end_hours',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#start_hours2',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#end_hours2',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#start_hours3',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#end_hours3',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	
	layui.form.on('radio(changest)', function(data){
		if(data.value == '2'){
			$('#changestset').show();
		}else{
			$('#changestset').hide();
		}
	});
	layui.form.on('radio(scoreset)', function(data){
		if(data.value == '1'){
			$('.scoreset1').show();
		}else{
			$('.scoreset1').hide();
		}
	});
	
	
	var ueditor = UE.getEditor('content');
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		field['info[content]'] = ueditor.getContent();
		//console.log(field);return;
		var index = layer.load();
		$.post("",field,function(data){
			layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					reload()
				},1000)
			}
		})
	})
  </script>
	<script>
	

	function previewImg(url){
		layer.open({type:1,area:'500px',content:'<div style="margin:auto auto;text-align:center"><img src="'+url+'" style="max-width:100%;max-height:100%"/></div>',title:false,shadeClose:true})
	}
	</script>
</body>
</html>